package com.burns.strawberry.controller;/**
 * Created by burns.
 *
 * @author <a href="http://www.esoon-soft.com/">burns</a>
 * @date 2020/12/06 23:05
 */

import com.burns.strawberry.po.User;
import com.burns.strawberry.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName UserController
 * @Description TODO
 * @Author Burns
 * @DAte 2020/12/6 23:05
 * @Version 1.0
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    //注入用户Service
    @Autowired
    private UserService userService;

    //查询所有用户
    @RequestMapping("/userList")
    public List<User> getAllUsers(){
        List<User> list = this.userService.getAllUsers();
        return list;
    }

    //删除用户
    @RequestMapping("/delete/{id}")
    public void delete(@PathVariable Integer id){
        this.userService.deleteUser(id);
    }
}
